<?php if(!class_exists('raintpl')){exit;}?><?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("header") . ( substr("header",-1,1) != "/" ? "/" : "" ) . basename("header") );?>
<?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("navigator") . ( substr("navigator",-1,1) != "/" ? "/" : "" ) . basename("navigator") );?>

<div id = "container">
	<h1 class = "header">สร้างตัวบ่งชี้</h1>

	<form action = '<?php echo $action;?>' method = 'post' enctype='multipart/form-data' id = "assessment-form">
		<input type = "hidden" name = "id" value = "<?php echo $id;?>">
		<input type = "hidden" name = "aid" value = "<?php echo $aid;?>">
		<ul class = 'form'>
			<li class = 'node'>
				<label for='name' class = 'label'>ตัวบ่งชี้ที่ : </label>
				<?php echo $id;?>.
				<select name = "sub">
					<?php $counter1=-1; if( isset($sub) && is_array($sub) && sizeof($sub) ) foreach( $sub as $key1 => $value1 ){ $counter1++; ?>
						<?php if( $value1==$last ){ ?>
							<option value="<?php echo $value1;?>" selected><?php echo $value1;?></option>
						<?php }else{ ?>
							<option value="<?php echo $value1;?>"><?php echo $value1;?></option>
						<?php } ?>
					<?php } ?>
				</select>
				<span class='require'>*</span>
				<span class = 'desc'></span>
			</li>
			<li class = 'node'>
				<label for='name' class = 'label'>ชื่อตัวบ่งชี้ : </label>
				<input type = 'text' id = 'name' class = 'input validate[required] text-input w300' name = 'name' value = "<?php echo $data['name'];?>">
				<span class='require'>*</span>
				<span class = 'desc'></span>
			</li>
			<li class = 'node'>
				<label for='target' class = 'label'>ประเภทตัวบ่งชี้ : </label>
				<select name = 'type'>
					<option value = '1' <?php if( $data['type'] == 1 ){ ?> selected <?php } ?>>กระบวนการ</option>
					<option value = '2' <?php if( $data['type'] == 2 ){ ?> selected <?php } ?>>ปัจจัยนำเข้า</option>
				</select>
				<span class = 'desc'></span>
			</li>
			<li>
				<input type = 'submit' value = ' ตกลง ' class = 'submit'>
				<input type = 'button' value = ' ยกเลิก ' class = 'submit' onclick = "location.href='assessment.php'">
				<input type = 'button' value = 'ลบตัวบ่งชี้' class = 'submit'  onclick = "location.href='assessment-delete.php?aid=<?php echo $aid;?>'">
			</li>
		</ul>
	</form>
</div>

<?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("footer") . ( substr("footer",-1,1) != "/" ? "/" : "" ) . basename("footer") );?>